import { request } from '@umijs/max';

/**
 * 获取用户订单 GET /api/order/getUserOrder
 */
export async function getUserOrder(userId: number) {
  return request<Admin.Order[]>('/api/order/getUserOrder/'+userId, {
    method: 'GET',
  });
}
/**
 * 获取用户订单 GET /api/order/getSellOrder
 */
export async function getSellOrder(userId: number) {
  return request<Admin.Order[]>('/api/order/getSellOrder/'+userId, {
    method: 'GET',
  });
}

/**
 * 根据订单id获取订单详细信息 GET /api/order/detail/id
 */
export async function getOrderDetail(id: number) {
  return request<Admin.Order>('/api/order/detail/' + id, {
    method: 'GET',
  });
}

/**
 * 修改订单状态 POST /api/order/status
 */
export async function changeOrderStatus(id: number, status: number) {
  return request<boolean>('/api/order/status' , {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data:{
      id:id,
      status:status,
    }
  });
}
